package com.qding.park.manager.app.queue.handle;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.alibaba.fastjson.JSONObject;
import com.qding.park.common.core.exceptions.BaseException;
import com.qding.park.common.core.redis.SerializeUtils;
import com.qding.park.manager.facade.queue.service.ReportFacade;
import com.qding.park.manager.pojo.ap.ApVisitingReminder;
import com.qding.park.manager.pojo.queue.QueueMsg;

/**
 * @ClassName: ReserveDelayTimeoutHandle
 * @Description: 邀请车辆进场
 * @author Comsys-Administrator
 * @date 2016年10月20日 上午10:10:31
 */
@Component("inviteInckeckHandle")
public class InviteInckeckHandle extends AbstractReportHandle {

    @Autowired
    private ReportFacade reportFacade;

    @Override
    void actualHandle(QueueMsg msg) throws BaseException {
        JSONObject data = (JSONObject) msg.getData();
        ApVisitingReminder apVisitingReminder = SerializeUtils.unSerialize(data.toJSONString(),
                ApVisitingReminder.class);
        reportFacade.inviteVisited(apVisitingReminder);

    }

    @Override
    boolean failDiscardRollBacK(QueueMsg msg) {
        _log.error("邀请车辆进场回滚:" + msg);
        return true;
    }

}
